package order

import (
	//"bee/models"
	//"bee/pkg/logging"
	//"github.com/go-resty/resty/v2"
	//"github.com/srlemon/gen-id/generator"
	//"github.com/tidwall/gjson"
	//"net/http"
	//"strings"
)

type DepositBill struct {
	CustomerID     string `json:"customerId"`
	IdentityID     string `json:"identityId"`
	AccountID      int    `json:"accountId"`
	DepositAmount  string `json:"depositAmount"`
	CouponAmount   string `json:"couponAmount"`
	EffectiveStart string `json:"effectiveStart"`
	EffectiveEnd   string `json:"effectiveEnd"`
	OperatorID     string `json:"operatorId"`
	SignerID       string `json:"signerId"`
	Remark         string `json:"remark"`
}

type InvoiceInfo struct {
	InvoiceType      string `json:"invoiceType"`
	InvoiceTitleType string `json:"invoiceTitleType"`
	Title            string `json:"title"`
}

type DeliveryInfo struct {
	ReceiverMobile string `json:"receiverMobile"`
	ReceiverEmail  string `json:"receiverEmail"`
}

type RemittancePay struct {
	RemittanceID string `json:"remittanceId"`
	Amount       int    `json:"amount"`
}

type CashOrder struct {
	DepositBill  `json:"depositBill"`
	InvoiceInfo  `json:"invoiceInfo"`
	DeliveryInfo `json:"deliveryInfo"`
	PaymentWay  string `json:"paymentWay"`
	RemittancePayList []RemittancePay `json:"remittancePayList"`
}

func SetDepositBill(fullName, customerId, identityId string, accountId int, remittanceId, appNamespace string ) (string, error) {
	return "", nil
	//appName := "opc"
	//uri := "/api/opc/deposit/createDepositBill"
	//
	//appId, appErr:= models.GetAppIdByName(appName)
	//if appErr != nil {
	//	return "", appErr
	//}
	//
	//appEnv, envErr:= models.GetAppEnvInfo(appId, appNamespace)
	//if envErr != nil {
	//	return "", envErr
	//}
	//
	//host := appEnv.AppDomain
	//if !strings.HasPrefix(host, "http://") {
	//	host = "http://" + host
	//}
	//
	//g := new(generator.GeneratorData)
	//
	//depositBill := DepositBill{
	//	CustomerID:     customerId,
	//	IdentityID:     identityId,
	//	AccountID:      accountId,
	//	DepositAmount:  "10000000",
	//	CouponAmount:   "",
	//	EffectiveStart: "",
	//	EffectiveEnd:   "",
	//	OperatorID:     "b763cad2fe2542018602d41fccc4ee39",
	//	SignerID:       "b763cad2fe2542018602d41fccc4ee39",
	//	Remark:         "",
	//}
	//
	//invoiceInfo := InvoiceInfo{
	//	InvoiceType:      "4",
	//	InvoiceTitleType: "2",
	//	Title:            fullName,
	//}
	//
	//deliveryInfo := DeliveryInfo{
	//	ReceiverMobile: g.GeneratorPhone(),
	//	ReceiverEmail:  g.GeneratorEmail(),
	//}
	//
	//paymentWay := "1"
	//
	//pay := RemittancePay{
	//	RemittanceID: remittanceId,
	//	Amount:       10000000,
	//}
	//
	//var remittancePayList []RemittancePay
	//remittancePayList = append(remittancePayList, pay)
	//
	//cashOrder := CashOrder{
	//	DepositBill:       depositBill,
	//	InvoiceInfo:       invoiceInfo,
	//	DeliveryInfo:      deliveryInfo,
	//	PaymentWay:        paymentWay,
	//	RemittancePayList: remittancePayList,
	//}
	//
	//headerData := make(map[string]string)
	//headerData["Content-Type"] = "application/json;charset=UTF-8"
	//
	//ssoCookie := &http.Cookie{
	//	Name:       "sso-epctoken",
	//	Value:      appEnv.Token,
	//}
	//
	//client := resty.New()
	//resp, depositErr := client.R().SetCookie(ssoCookie).
	//	SetHeaders(headerData).SetBody(cashOrder).
	//	Post(host + uri)
	//
	//if depositErr != nil {
	//	return "", depositErr
	//}
	//logging.ZapLogger.Infow("创建充值单", "result", resp)
	//depositId := gjson.GetBytes(resp.Body(), "data.depositId").String()
	//return depositId, nil
}

